package cn.myra.testbefore;

public class TestException {

	public static void main(String[] args) {
		
	}
	
	private static void test01() {
		int[] a = new int[5];
		try {
			a[3] =90;
			System.exit(0);
		}catch(RuntimeException e) {
			System.out.println(e.getMessage());
			e.printStackTrace();
		}finally {
			System.out.println("执行finally");
		}
		
		System.out.println("程序运行结束");
	}
	
	

	private static void test02() {
		int[] a = new int[5];
		try {
			a[3] =90;
			return;
		}catch(RuntimeException e) {
			System.out.println(e.getMessage());
			e.printStackTrace();
		}finally {
			System.out.println("执行finally");
		}
		
		System.out.println("程序运行结束");
	}
	
	

	private static void test03() {
		int[] a = new int[5];
		try {
			a[5] =90;
			return;
		}catch(RuntimeException e) {
			System.out.println(e.getMessage());
			e.printStackTrace();
		}finally {
			System.out.println("执行finally");
		}
		
		System.out.println("程序运行结束");
	}
	
}
